/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 100428 (10.4.28-MariaDB)
 Source Host           : localhost:3306
 Source Schema         : ledger_db

 Target Server Type    : MySQL
 Target Server Version : 100428 (10.4.28-MariaDB)
 File Encoding         : 65001

 Date: 03/07/2025 22:36:31
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ledgers
-- ----------------------------
DROP TABLE IF EXISTS `ledgers`;
CREATE TABLE `ledgers` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '台账ID',
  `owner_id` bigint(20) NOT NULL COMMENT '台账创建者用户ID',
  `name` varchar(200) NOT NULL COMMENT '台账名称',
  `is_template` tinyint(1) DEFAULT 0 COMMENT '是否为模板',
  `is_public` tinyint(1) DEFAULT 0 COMMENT '是否公开模板',
  `visibility_scope` varchar(50) DEFAULT 'ALL' COMMENT '可见范围（ALL/DEPARTMENT）',
  `created_at` datetime DEFAULT current_timestamp() COMMENT '创建时间',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of ledgers
-- ----------------------------
BEGIN;
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (1, 1, '客户联系记录', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (2, 1, '员工出勤台账', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (3, 1, '项目进度表', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (4, 1, '采购订单台账', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (5, 1, '设备维护记录', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (6, 1, '库存管理台账', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (7, 1, '培训计划表', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (8, 1, '合同信息台账', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (9, 1, '销售记录表', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
INSERT INTO `ledgers` (`id`, `owner_id`, `name`, `is_template`, `is_public`, `visibility_scope`, `created_at`, `updated_at`) VALUES (10, 1, '投诉处理台账', 0, 0, 'DEPARTMENT', '2025-07-01 12:00:00', '2025-07-01 12:00:00');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
